package com.example.demo.controllers;

import com.example.demo.services.DefaultInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
public class DefaultController {
    @Autowired
    private DefaultInterface selfDefaultInterface;

    @RequestMapping(value="/hello-world",method = RequestMethod.GET)
    public void helloWorld(HttpServletResponse response, HttpServletRequest request,@RequestParam String name) throws IOException {
       response.getWriter().println(selfDefaultInterface.sayHelloWorld(name));
    }
}
